package com.it.myd.bean.main;

import com.google.gson.JsonObject;

import java.util.List;

public class ReturnValue<T> {

    private String retCode;
    private String retDesc;
    private String retDesc1;
    private List<T> retList;
    private List<Object> objList;
    private List<Object> objList1;
    private List<Object> objList2;
    private String retJson;

    public String getRetDesc1() {
        return retDesc1;
    }

    public void setRetDesc1(String retDesc1) {
        this.retDesc1 = retDesc1;
    }

    public String toJson(){
        JsonObject obj = new JsonObject();
        obj.addProperty("retCode",retCode);
        obj.addProperty("retDesc",retDesc);
        if(this.retDesc1 != null){
            obj.addProperty("retDesc1",retDesc1);
        }
        return obj.toString();
    }

    public void isSuccess(String desc){
        this.retCode = "0000";
        this.retDesc = desc;
    }

    public void isSuccess(){
        this.retCode = "0000";
        this.retDesc = "处理成功";
    }

    public void isFail(String desc){
        this.retCode = "9999";
        this.retDesc = desc;
    }

    public void isFail(){
        this.retCode = "9999";
        this.retDesc = "处理失败,联系管理员";
    }

    public List<Object> getObjList2() {
        return objList2;
    }

    public void setObjList2(List<Object> objList2) {
        this.objList2 = objList2;
    }

    public String getRetCode() {
        return retCode;
    }

    public void setRetCode(String retCode) {
        this.retCode = retCode;
    }

    public String getRetDesc() {
        return retDesc;
    }

    public void setRetDesc(String retDesc) {
        this.retDesc = retDesc;
    }

    public List<T> getRetList() {
        return retList;
    }

    public void setRetList(List<T> retList) {
        this.retList = retList;
    }

    public String getRetJson() {
        return retJson;
    }

    public void setRetJson(String retJson) {
        this.retJson = retJson;
    }

    public List<Object> getObjList() {
        return objList;
    }

    public void setObjList(List<Object> objList) {
        this.objList = objList;
    }

    public List<Object> getObjList1() {
        return objList1;
    }

    public void setObjList1(List<Object> objList1) {
        this.objList1 = objList1;
    }
}
